#include<bits/stdc++.h>
using namespace std;
#define N 1005
int a[N], dp[N];
int main()
{
    int n, mxlen = 0;
    cin>>n;
    for(int i = 1; i <= n; ++i)
        cin>>a[i];
    for(int i = 1; i <= n; ++i)
    {
        dp[i] = 1;
        for(int j = 1; j < i; ++j)
        {
            if(a[i] > a[j])
                dp[i] = max(dp[i], dp[j] + 1);
        } 
    }
    for(int i = 1; i <= n; ++i)
        mxlen = max(mxlen, dp[i]);
    cout<<mxlen;
    return 0;
}

